package com.jadcon.bedbreakfast.domain;

import java.util.List;
import java.util.Random;

import org.apache.log4j.Logger;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration( { "/spring-security.xml", "/spring-service.xml" })
public class SuiteServiceTestIntegration {

	private Logger logger = Logger.getLogger(SuiteServiceTestIntegration.class);

	@Autowired
	SuiteService suiteService;

	@Test
	public void getSuiteByNumber() {
		Random random = new Random();
		int suiteNumber = random.nextInt(8) + 101;
		Suite suite = suiteService.getSuiteByNumber(suiteNumber);
		if (logger.isDebugEnabled()) {
			logger.debug("Suite selected: " + suite.getName());
		}
	}

	@SuppressWarnings("unchecked")
	@Test
	public void getSuiteList() {
		List suiteList = suiteService.getSuiteList();
		if (logger.isDebugEnabled()) {
			logger.debug("Suite list seleted");
			logger.debug("Total suites in list: " + suiteList.size());
		}
	}
	
	@Test
	public void getCapacity() {
		List <Suite> suiteList = suiteService.getSuiteList();
		Suite suite = suiteList.get(0);
		int suiteNumber = suite.getNumber();
		@SuppressWarnings("unused")
		int capacity = suiteService.getCapacity(suiteNumber);
	}


}
